package com.framework.movieManagement;

import com.framework.TestBase;
import com.framework.model.Movie;
import org.testng.annotations.Test;

import static org.junit.Assert.assertTrue;

public class AddMovie extends TestBase {

    @Test (priority = 1)
    public void addMovie() {
        app.getUserHelper().logout();
        app.getUserHelper().loginAs(ADMIN);
        Movie movie = new Movie().setTitle("Boro").setYear("2011");
        app.getMovieHelper().create(movie);
        assertTrue(app.getMovieHelper().isCreated(movie));
    }

    @Test (priority = 2)
    public void emptyTitle() {
        app.getUserHelper().logout();
        app.getUserHelper().loginAs(ADMIN);
        Movie movie = new Movie().setTitle("").setYear("2011");
        app.getMovieHelper().create(movie);
        assertTrue(app.getMovieHelper().isNoTitleErrorPresent());
    }

    @Test (priority = 3)
    public void emptyYear() {
        app.getUserHelper().logout();
        app.getUserHelper().loginAs(ADMIN);
        Movie movie = new Movie().setTitle("Boro").setYear("");
        app.getMovieHelper().create(movie);
        assertTrue(app.getMovieHelper().isNoYearErrorPresent());
    }

}
